#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e5+10;
int lst,nodenum,cnt,h[N<<1],n;
char s[N];
ll siz[N<<1],ans;
struct edge{int v,nxt;}e[N<<1];
void link(int x,int y){e[++cnt] = (edge){y,h[x]};h[x] = cnt;}
struct suf{int link,len;unordered_map<char,int> ch;}t[N<<1];

void add(char c){
	int cur = ++nodenum,p = lst; lst = cur; t[cur].len = t[p].len + 1; 
	while(~p && !t[p].ch[c]) t[p].ch[c] = cur,p = t[p].link;
	if(!~p) return t[cur].link = 0,void();
	int q = t[p].ch[c]; if(t[p].len + 1 == t[q].len) return t[cur].link = q,void();
	int clo = ++nodenum; t[clo].link = t[q].link; t[clo].ch = t[q].ch; t[clo].len = t[p].len + 1;
	while(~p && t[p].ch[c] == q) t[p].ch[c] = clo,p = t[p].link;
	t[q].link = t[cur].link = clo;
}

void dfs(int x){if(siz[x]) return; int y;for(auto d : t[x].ch) dfs(y = d.se),siz[x] += siz[y];siz[x]++;if(siz[x] > 1) ans = max(ans,siz[x] * 1ll * t[x].len);}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	scanf("%s",s+1); n = strlen(s+1); t[0].link = -1;
	for(int i = 1;i <= n;i++) add(s[i]);
	dfs(0);
	printf("%lld\n",ans);
	return 0;
}

